<%@page import="helpers.CkeditorConfigHelper"%>
<%@page import="models.PageModel"%>
<%@page import="java.util.TreeMap"%>
<%@page import="helpers.UrlHelper"%>
<%
TreeMap check = (TreeMap) request.getAttribute("check");
String success = (String) request.getAttribute("success");
PageModel static_page = (PageModel) request.getAttribute("page");
String title = (String) request.getAttribute("title");
%>
<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %>
<jsp:include page="/admin/demo/layouts/header.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>
<script type="text/javascript" src="/admin/demo/js/form_page.js"></script>
	<% if (success != null) {%>
	<div class="success block" ><%=success %></div>
	<% } %>
	<div class="block">
		<form id="edit_config_form" action="" method="post">
			<div id="add_items">
				<table class="formPage">
					<thead>
						<tr>
							<th colspan="2">
								<%=title %>
							</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td class="label"><label for="p_title">Title:</label></td>
							<td class="smallDesc type">
								<% if (check.get("title") != null) { %>
									<span class="error"><%=check.get("title") %></span>
								<% } %>
								<input id="p_title" class="text" type="text" name="title" value="<%=static_page.getTitle() != null ? static_page.getTitle() : "" %>" maxlength="100">
								<div class="description">Title static page.</div>
							</td>
						</tr>
						<tr>
							<td class="label"><label for="p_content">Content:</label></td>
							<td class="smallDesc type">
								<% if (check.get("content") != null) { %>
									<span class="error"><%=check.get("content") %></span>
								<% } %>
								<textarea id="p_content" class="text ckeditor" name="content"  rows="7" cols="80"><%=static_page.getContent() != null ? static_page.getContent() : "" %></textarea>
								<ckeditor:replaceAll className="ckeditor" basePath="/sources/ckeditor/" 
									config="<%=CkeditorConfigHelper.createConfig() %>"
								   events="<%=CkeditorConfigHelper.createEventHandlers() %>" />
								<div class="description">Your meta description site.</div>
							</td>
						</tr>
					</tbody>
				</table>
				
				<table class="formPage">
					<tfoot>
						<tr>
							<td><input type="reset" class="button" title="Reset form" alt="Reset form" value="Reset" name="reset" id="reset-user-submit"></td>
							<td><input type="submit" class="button" title="Save link" alt="Save form" value="Save" name="save" id="send-user-submit"></td>
						</tr>
					</tfoot>
				</table>
			</div>
		</form>
	</div>

<jsp:include page="/admin/demo/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>